home *** CD-ROM | disk | FTP | other *** search
/ BCI NET 2 / BCI NET 2.iso / archives / programming / amos / amoslist-0295.lzh / AMOSLIST / text0271.txt < prev    next >
Encoding:
Text File  |  1995-03-01  |  976 b   |  31 lines

  1. Forwarded message:
  2.  
  3. >   I have one other small problem (more an annoyance, really) in that
  4. > I use Input #1 at the start of the game to load in the 
  5. > level data which takes the form of several arrays of dimensions 
  6. > (40,40) or so, and it takes absolutely *ages*. Is there
  7. > any quicker way of loading variables from disk?  I have tried
  8.  
  9. I would do it this way:
  10.  
  11. First install MakeLib extension and LDos extension.
  12. Both are on aminet.
  13. Then just
  14.  
  15. _LEVELDATA=Ma Malloc(40*40*_ITEM_SIZE*_NUMBER_OF_LEVELS,$1)
  16. Lopen 1,_FILENAME$,0
  17. If LLoad(1,_LEVELDATA,Fsize(_FILENAME$)>-1
  18.     'The level data is now in mem. Takes 0 seconds :-)
  19. Else
  20.     'An error occurred
  21. Endif
  22. Lclose 1 
  23.  
  24. LDos and Makelib revolutionize disk access in Amos IMO.
  25. I've never used the shitty slow Line Input# or Input# commands after 
  26. installing these two wonder extensions :-)
  27.  
  28. As a bonus, the levels take _MUCH_ less disk space if saved just as 
  29. unformatted blocks of data instead of Print#ing them to an ascii file.
  30.  
  31.